<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Xlib Rendering</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
<link rel="home" href="index.html" title="The gdk-pixbuf Library">
<link rel="up" href="rn01.html" title="API Reference">
<link rel="prev" href="gdk-pixbuf-gdk-pixbuf-xlib-init.html" title="gdk-pixbuf Xlib initialization">
<link rel="next" href="gdk-pixbuf-gdk-pixbuf-xlib-from-drawables.html" title="X Drawables to Pixbufs">
<meta name="generator" content="GTK-Doc V1.11 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="reference" href="rn01.html" title="API Reference">
<link rel="reference" href="rn02.html" title="Tools Reference">
<link rel="index" href="api-index-full.html" title="Index of all symbols">
<link rel="index" href="api-index-deprecated.html" title="Index of deprecated symbols">
<link rel="index" href="api-index-2-2.html" title="Index of new symbols in 2.2">
<link rel="index" href="api-index-2-4.html" title="Index of new symbols in 2.4">
<link rel="index" href="api-index-2-6.html" title="Index of new symbols in 2.6">
<link rel="index" href="api-index-2-8.html" title="Index of new symbols in 2.8">
<link rel="index" href="api-index-2-10.html" title="Index of new symbols in 2.10">
<link rel="index" href="api-index-2-12.html" title="Index of new symbols in 2.12">
<link rel="index" href="api-index-2-14.html" title="Index of new symbols in 2.14">
<link rel="appendix" href="apa.html" title="Appendix A. Porting applications from Imlib to gdk-pixbuf">
<link rel="appendix" href="license.html" title="Appendix B. License">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gdk-pixbuf-gdk-pixbuf-xlib-init.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="rn01.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">The gdk-pixbuf Library</th>
<td><a accesskey="n" href="gdk-pixbuf-gdk-pixbuf-xlib-from-drawables.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#gdk-pixbuf-gdk-pixbuf-xlib-rendering.synopsis" class="shortcut">Top</a>
                 | 
                <a href="#gdk-pixbuf-gdk-pixbuf-xlib-rendering.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry" lang="en">
<a name="gdk-pixbuf-gdk-pixbuf-xlib-rendering"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gdk-pixbuf-gdk-pixbuf-xlib-rendering.top_of_page"></a>Xlib Rendering</span></h2>
<p>Xlib Rendering — Rendering a pixbuf to an X drawable.</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="gdk-pixbuf-gdk-pixbuf-xlib-rendering.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">

#include &lt;gdk-pixbuf/gdk-pixbuf.h&gt;

void                <a class="link" href="gdk-pixbuf-gdk-pixbuf-xlib-rendering.html#gdk-pixbuf-xlib-render-threshold-alpha" title="gdk_pixbuf_xlib_render_threshold_alpha ()">gdk_pixbuf_xlib_render_threshold_alpha</a>
                                                        (<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                                         Pixmap bitmap,
                                                         int src_x,
                                                         int src_y,
                                                         int dest_x,
                                                         int dest_y,
                                                         int width,
                                                         int height,
                                                         int alpha_threshold);
void                <a class="link" href="gdk-pixbuf-gdk-pixbuf-xlib-rendering.html#gdk-pixbuf-xlib-render-to-drawable" title="gdk_pixbuf_xlib_render_to_drawable ()">gdk_pixbuf_xlib_render_to_drawable</a>  (<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                                         Drawable drawable,
                                                         GC gc,
                                                         int src_x,
                                                         int src_y,
                                                         int dest_x,
                                                         int dest_y,
                                                         int width,
                                                         int height,
                                                         <a class="link" href="gdk-pixbuf-gdk-pixbuf-xlib-rgb.html#XlibRgbDither" title="enum XlibRgbDither">XlibRgbDither</a> dither,
                                                         int x_dither,
                                                         int y_dither);
void                <a class="link" href="gdk-pixbuf-gdk-pixbuf-xlib-rendering.html#gdk-pixbuf-xlib-render-to-drawable-alpha" title="gdk_pixbuf_xlib_render_to_drawable_alpha ()">gdk_pixbuf_xlib_render_to_drawable_alpha</a>
                                                        (<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                                         Drawable drawable,
                                                         int src_x,
                                                         int src_y,
                                                         int dest_x,
                                                         int dest_y,
                                                         int width,
                                                         int height,
                                                         <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbufAlphaMode" title="enum GdkPixbufAlphaMode">GdkPixbufAlphaMode</a> alpha_mode,
                                                         int alpha_threshold,
                                                         <a class="link" href="gdk-pixbuf-gdk-pixbuf-xlib-rgb.html#XlibRgbDither" title="enum XlibRgbDither">XlibRgbDither</a> dither,
                                                         int x_dither,
                                                         int y_dither);
void                <a class="link" href="gdk-pixbuf-gdk-pixbuf-xlib-rendering.html#gdk-pixbuf-xlib-render-pixmap-and-mask" title="gdk_pixbuf_xlib_render_pixmap_and_mask ()">gdk_pixbuf_xlib_render_pixmap_and_mask</a>
                                                        (<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                                         Pixmap *pixmap_return,
                                                         Pixmap *mask_return,
                                                         int alpha_threshold);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="gdk-pixbuf-gdk-pixbuf-xlib-rendering.description"></a><h2>Description</h2>
<p>
    The <span class="application">gdk-pixbuf</span> Xlib library provides several convenience
    functions to render pixbufs to X drawables.  It uses XlibRGB to
    render the image data.
  </p>
<p>
    These functions are analogous to those for the GDK version of
    <span class="application">gdk-pixbuf</span>.
  </p>
</div>
<div class="refsect1" lang="en">
<a name="gdk-pixbuf-gdk-pixbuf-xlib-rendering.details"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="gdk-pixbuf-xlib-render-threshold-alpha"></a><h3>gdk_pixbuf_xlib_render_threshold_alpha ()</h3>
<pre class="programlisting">void                gdk_pixbuf_xlib_render_threshold_alpha
                                                        (<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                                         Pixmap bitmap,
                                                         int src_x,
                                                         int src_y,
                                                         int dest_x,
                                                         int dest_y,
                                                         int width,
                                                         int height,
                                                         int alpha_threshold);</pre>
<p>
Takes the opacity values in a rectangular portion of a pixbuf and thresholds
them to produce a bi-level alpha mask that can be used as a clipping mask for
a drawable.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixbuf</code></em> :</span></p></td>
<td> A pixbuf.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>bitmap</code></em> :</span></p></td>
<td> Bitmap where the bilevel mask will be painted to.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>src_x</code></em> :</span></p></td>
<td> Source X coordinate.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>src_y</code></em> :</span></p></td>
<td> source Y coordinate.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest_x</code></em> :</span></p></td>
<td> Destination X coordinate.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest_y</code></em> :</span></p></td>
<td> Destination Y coordinate.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
<td> Width of region to threshold.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
<td> Height of region to threshold.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>alpha_threshold</code></em> :</span></p></td>
<td> Opacity values below this will be painted as zero; all
other values will be painted as one.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-pixbuf-xlib-render-to-drawable"></a><h3>gdk_pixbuf_xlib_render_to_drawable ()</h3>
<pre class="programlisting">void                gdk_pixbuf_xlib_render_to_drawable  (<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                                         Drawable drawable,
                                                         GC gc,
                                                         int src_x,
                                                         int src_y,
                                                         int dest_x,
                                                         int dest_y,
                                                         int width,
                                                         int height,
                                                         <a class="link" href="gdk-pixbuf-gdk-pixbuf-xlib-rgb.html#XlibRgbDither" title="enum XlibRgbDither">XlibRgbDither</a> dither,
                                                         int x_dither,
                                                         int y_dither);</pre>
<p>
Renders a rectangular portion of a pixbuf to a drawable while using the
specified GC.  This is done using XlibRGB, so the specified drawable must
have the XlibRGB visual and colormap.  Note that this function will ignore
the opacity information for images with an alpha channel; the GC must already
have the clipping mask set if you want transparent regions to show through.
</p>
<p>
For an explanation of dither offsets, see the XlibRGB documentation.  In
brief, the dither offset is important when re-rendering partial regions of an
image to a rendered version of the full image, or for when the offsets to a
base position change, as in scrolling.  The dither matrix has to be shifted
for consistent visual results.  If you do not have any of these cases, the
dither offsets can be both zero.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixbuf</code></em> :</span></p></td>
<td> A pixbuf.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>drawable</code></em> :</span></p></td>
<td> Destination drawable.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>gc</code></em> :</span></p></td>
<td> GC used for rendering.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>src_x</code></em> :</span></p></td>
<td> Source X coordinate within pixbuf.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>src_y</code></em> :</span></p></td>
<td> Source Y coordinate within pixbuf.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest_x</code></em> :</span></p></td>
<td> Destination X coordinate within drawable.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest_y</code></em> :</span></p></td>
<td> Destination Y coordinate within drawable.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
<td> Width of region to render, in pixels.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
<td> Height of region to render, in pixels.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dither</code></em> :</span></p></td>
<td> Dithering mode for XlibRGB.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>x_dither</code></em> :</span></p></td>
<td> X offset for dither.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>y_dither</code></em> :</span></p></td>
<td> Y offset for dither.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-pixbuf-xlib-render-to-drawable-alpha"></a><h3>gdk_pixbuf_xlib_render_to_drawable_alpha ()</h3>
<pre class="programlisting">void                gdk_pixbuf_xlib_render_to_drawable_alpha
                                                        (<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                                         Drawable drawable,
                                                         int src_x,
                                                         int src_y,
                                                         int dest_x,
                                                         int dest_y,
                                                         int width,
                                                         int height,
                                                         <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbufAlphaMode" title="enum GdkPixbufAlphaMode">GdkPixbufAlphaMode</a> alpha_mode,
                                                         int alpha_threshold,
                                                         <a class="link" href="gdk-pixbuf-gdk-pixbuf-xlib-rgb.html#XlibRgbDither" title="enum XlibRgbDither">XlibRgbDither</a> dither,
                                                         int x_dither,
                                                         int y_dither);</pre>
<p>
Renders a rectangular portion of a pixbuf to a drawable.  This is done using
XlibRGB, so the specified drawable must have the XlibRGB visual and colormap.
</p>
<p>
When used with <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GDK-PIXBUF-ALPHA-BILEVEL--CAPS"><span class="type">GDK_PIXBUF_ALPHA_BILEVEL</span></a>, this function has to create a bitmap
out of the thresholded alpha channel of the image and, it has to set this
bitmap as the clipping mask for the GC used for drawing.  This can be a
significant performance penalty depending on the size and the complexity of
the alpha channel of the image.  If performance is crucial, consider handling
the alpha channel yourself (possibly by caching it in your application) and
using <a class="link" href="gdk-pixbuf-gdk-pixbuf-xlib-rendering.html#gdk-pixbuf-xlib-render-to-drawable" title="gdk_pixbuf_xlib_render_to_drawable ()"><code class="function">gdk_pixbuf_xlib_render_to_drawable()</code></a> or GdkRGB directly instead.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixbuf</code></em> :</span></p></td>
<td> A pixbuf.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>drawable</code></em> :</span></p></td>
<td> Destination drawable.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>src_x</code></em> :</span></p></td>
<td> Source X coordinate within pixbuf.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>src_y</code></em> :</span></p></td>
<td> Source Y coordinates within pixbuf.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest_x</code></em> :</span></p></td>
<td> Destination X coordinate within drawable.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest_y</code></em> :</span></p></td>
<td> Destination Y coordinate within drawable.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
<td> Width of region to render, in pixels.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
<td> Height of region to render, in pixels.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>alpha_mode</code></em> :</span></p></td>
<td> If the image does not have opacity information, this is ignored.
Otherwise, specifies how to handle transparency when rendering.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>alpha_threshold</code></em> :</span></p></td>
<td> If the image does have opacity information and <em class="parameter"><code>alpha_mode</code></em>
is GDK_PIXBUF_ALPHA_BILEVEL, specifies the threshold value for opacity
values.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dither</code></em> :</span></p></td>
<td> Dithering mode for XlibRGB.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>x_dither</code></em> :</span></p></td>
<td> X offset for dither.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>y_dither</code></em> :</span></p></td>
<td> Y offset for dither.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-pixbuf-xlib-render-pixmap-and-mask"></a><h3>gdk_pixbuf_xlib_render_pixmap_and_mask ()</h3>
<pre class="programlisting">void                gdk_pixbuf_xlib_render_pixmap_and_mask
                                                        (<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                                         Pixmap *pixmap_return,
                                                         Pixmap *mask_return,
                                                         int alpha_threshold);</pre>
<p>
Creates a pixmap and a mask bitmap which are returned in the <em class="parameter"><code>pixmap_return</code></em>
and <em class="parameter"><code>mask_return</code></em> arguments, respectively, and renders a pixbuf and its
corresponding tresholded alpha mask to them.  This is merely a convenience
function; applications that need to render pixbufs with dither offsets or to
given drawables should use <a class="link" href="gdk-pixbuf-gdk-pixbuf-xlib-rendering.html#gdk-pixbuf-xlib-render-to-drawable-alpha" title="gdk_pixbuf_xlib_render_to_drawable_alpha ()"><code class="function">gdk_pixbuf_xlib_render_to_drawable_alpha()</code></a> or
<a class="link" href="gdk-pixbuf-gdk-pixbuf-xlib-rendering.html#gdk-pixbuf-xlib-render-to-drawable" title="gdk_pixbuf_xlib_render_to_drawable ()"><code class="function">gdk_pixbuf_xlib_render_to_drawable()</code></a>, and
<a class="link" href="gdk-pixbuf-gdk-pixbuf-xlib-rendering.html#gdk-pixbuf-xlib-render-threshold-alpha" title="gdk_pixbuf_xlib_render_threshold_alpha ()"><code class="function">gdk_pixbuf_xlib_render_threshold_alpha()</code></a>.
</p>
<p>
If the pixbuf does not have an alpha channel, then *<em class="parameter"><code>mask_return</code></em> will be set
to None.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixbuf</code></em> :</span></p></td>
<td> A pixbuf.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixmap_return</code></em> :</span></p></td>
<td> Return value for the created pixmap.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>mask_return</code></em> :</span></p></td>
<td> Return value for the created mask.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>alpha_threshold</code></em> :</span></p></td>
<td> Threshold value for opacity values.
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.11</div>
</body>
</html>
